<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user', function (Blueprint $table) {
            $table->increments('id');
            $table->string("openid",32)->comment("微信openid");
            $table->string("avatar",150)->nullable()->comment("微信头像");
            $table->string("nickname",255)->nullable()->comment("微信昵称");
            $table->string("username",100)->nullable()->comment("姓名");
            $table->string("phone",20)->nullable()->comment("手机号");
            $table->integer("sell_id")->default(0)->comment("销售ID");
            $table->integer("parent_id")->default(0)->comment("父级ID");
            $table->integer("user_type")->default(1)->comment("用户类型:1游客,2销售,3商户");
            $table->decimal("score",10,2)->default(0)->comment("积分");
            $table->decimal("recharge",10,2)->default(0)->comment("充值金额");
            $table->string("share_image",150)->nullable()->comment("二维码");
            $table->string("token",50)->comment("token");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user');
    }
}
